home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 September
/
Macworld (1997-09).dmg
/
Shareware World
/
Utilities
/
Text Processing
/
AlphaLite.6.52
/
Tcl
/
SystemCode
/
browser.tcl
< prev
next >
Wrap
Text File
|
1996-08-15
|
1KB
|
52 lines
#=============================================================================
# Browser mode.
#=============================================================================
proc dummyBrws {} {}
proc upBrowse {} {
set limit [nextLineStart [nextLineStart 0]]
if {[getPos] > $limit} {
set limit [expr [getPos] - 1]
}
select [lineStart $limit] [nextLineStart $limit]
}
proc downBrowse {} {
set pos [getPos]
if {$pos < [nextLineStart 0]} {
set pos [nextLineStart 0]
}
if {[nextLineStart $pos] != [maxPos]} {
select [nextLineStart $pos] [nextLineStart [nextLineStart $pos]]
}
}
proc nextMatch {{wname "*Batch Find*"}} {
set wins [winNames]
set res [lsearch $wins $wname]
if {$res < 0} {
set res [lsearch -regexp $wins {\*.*\*}]
if {$res < 0} return
}
set win [lindex $wins $res]
bringToFront $win
downBrowse
gotoMatch
dispErr $win
}
bind '\r' gotoMatch Brws
bind enter gotoMatch Brws
ascii 0x3 gotoMatch Brws
bind down downBrowse Brws
bind up upBrowse Brws
bind 'n' <z> downBrowse Brws
bind 'p' <z> upBrowse Brws
ascii 0x20 downBrowse Brws
ascii 0x8 upBrowse Brws